<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Insert title here</title>
<link href="/resource/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="/resource/js/jquery-3.2.1.js"></script>
<script type="text/javascript" src="/resource/js/bootstrap.min.js"></script>
<script type="text/javascript">

	$.post(
			"/getProducts",
			function(msg){
				for ( var i in msg) {
					$("#t1").append("<input type='checkbox' name='pnames' value='"+msg[i].pid+"'>"+msg[i].pname+"");
				}
			}
	)
	
	
	function add(){
		$.post(
				"/add",
				$("form").serialize(),
				function(flag){
					if(flag){
						alert("添加成功");
						location="/list";
					}
				}
		)
		
	}

</script>
<head>
<meta charset="UTF-8">
<title>新增店铺</title>
</head>
<body>

	<form>
	<table>
	<tr>
	<td>编号:</td>
	<td>
	<input type="text" name="">
	</td>
	</tr>
	<tr>
	<td>商铺名称:</td>
	<td>
	<input type="text" name="sname">
	</td>
	</tr>
	<tr>
	<td>创建日期:</td>
	<td>
	<input type="date" name="stime" >
	</td>
	</tr>
	<tr>
	<td>销售商品:</td>
	<td id="t1">
	
	</td>
	</tr>
	<tr>
	<td colspan="10">
	<button type="button" onclick="add()">保存</button>
	
	</td>
	
	</tr>
	
	
	</table>
	</form>
</body>
</html>